import React, { useEffect } from "react";

import ActionEditInventoryModal from "./ActionEditInventoryModal";
import ActionEditSkuCodeModal from "./ActionEditSkuCodeModal";
import ActionUploadSkuToShopModal from "./ActionUploadSkuToShopModal";
import ActionEnableSynchronizedInventoryModal from "./ActionEnableSynchronizedInventoryModal";
import ActionConfirmDeleteShopSkuModal from "./ActionConfirmDeleteShopSkuModal";
import ActionOnlineImportGoodsModal from "./ActionOnlineImportGoodsModal";
import ActionExportExcelModal from "./ActionExportExcelModal";
import ActionExcelImportProductsModal from "./ActionExcelImportProductsModal";
import EncodeSetting from '../../../common/EncodeSetting';
import ActionCreateSysGoodsModal from "./ActionCreateSysGoodsModal";
import ActionCreateSysGoodsResultModal from "./ActionCreateSysGoodsResultModal";

const Actions = props => {
	const { visibleDialogName, customDialogProps, ...resetProps } = props;

	const realProps = {
		...resetProps,
		...customDialogProps
	};
	return (
		<>
			{/** 批量修改库存 */}
			{visibleDialogName === "ActionBatchEditInventoryModal" && (
				<ActionEditInventoryModal {...realProps} commandText="批量修改库存确定后" />
			)}
			{/** 编辑库存 */}
			{visibleDialogName === "ActionEditInventoryModal" && (
				<ActionEditInventoryModal {...realProps} commandText="编辑库存确定后" />
			)}

			{/* /** 批量编辑商品编码  */}
			{visibleDialogName === "ActionEditSkuCodeModal" && <ActionEditSkuCodeModal {...realProps} />}
			{/* // 上传商品编码 */}
			{visibleDialogName === "ActionUploadSkuToShopModal" && <ActionUploadSkuToShopModal {...realProps} />}
			{/* // 禁止同步库存 */}
			{visibleDialogName === "ActionDisableSynchronizedInventoryModal" && (
				<ActionEnableSynchronizedInventoryModal
					{...realProps}
					title="禁止同步库存"
					commandText="禁止同步库存确认后"
					alert={"确定禁止库存同步？"}
				/>
			)}
			{/* // 开启同步库存 */}
			{visibleDialogName === "ActionEnableSynchronizedInventoryModal" && (
				<ActionEnableSynchronizedInventoryModal
					{...realProps}
					title="开启同步库存"
					commandText="开启同步库存确认后"
					alert={
						realProps.isSkuType
							? "请选择需要同步的库存"
							: "请选择需要同步的库存，开启后库存数量将同步至线上平台。sku维度已开启的会更改状态和库存类型"
					}
				/>
			)}
			{/* // 手动同步库存 */}
			{visibleDialogName === "ActionManuallySynchronizingInventoryModal" && (
				<ActionEnableSynchronizedInventoryModal
					{...realProps}
					title="手动同步库存"
					commandText="手动同步库存确认后"
					alert="请选择需要同步的库存，每次库存同步的链接数请勿超过100条，否则将影响自动库存同步的时效。"
				/>
			)}
			{visibleDialogName === "ActionConfirmDeleteShopSkuModal" && <ActionConfirmDeleteShopSkuModal {...realProps} />}
			{/* 导入更新商品  同步店铺商品 */}
			{visibleDialogName === "ActionOnlineImportGoodsModal" && <ActionOnlineImportGoodsModal {...realProps} />}
			{/* 导入更新商品 Excel导入 */}
			{visibleDialogName === "ActionExcelImportProductsModal" && <ActionExcelImportProductsModal {...realProps} />}
			{/* 导出店铺商品 */}
			{visibleDialogName === "ActionExportExcelModal" && <ActionExportExcelModal {...realProps} />}
			{/* 自动生成设置 */}
			{visibleDialogName === "EncodeSettingModal" && <EncodeSetting {...realProps} />}
			{/* 生成系统商品 */}
			{visibleDialogName === "ActionCreateSysGoodsModal" && <ActionCreateSysGoodsModal {...realProps} />}
			{/* 生成系统商品结果 */}
			{visibleDialogName === "ActionCreateSysGoodsResultModal" && <ActionCreateSysGoodsResultModal {...realProps} />}
			{/* {visibleDialogName === "ActionExportExcelModal" && <ActionExportExcelModal {...realProps} />} */}
		</>
	);
};
export default React.memo(Actions);
